#
# Makefile for NewLife module: console.ko
#
MODULE_NAME := sh

# Utiltiy
export CC := i386-elf-g++ -fno-exceptions -g -c
export AS := nasm -f elf
export LD := i386-elf-ld
MAKE := make

## CONFIGURATION
# Directory of include file
export INC_DIR := ../common/include
CC += -I $(INC_DIR)/
AS += -I $(INC_DIR)/asm-inc/
# Directory of intermedia/object file
export OBJ_DIR := /home/forever043/SVN/build/modules/$(MODULE_NAME)
export LIB_DIR := ../common/libs
export VPATH := $(OBJ_DIR) $(LIB_DIR) $(INC_DIR)


LIB := $(LIB_DIR)/fstat.o $(LIB_DIR)/lseek.o $(LIB_DIR)/write.o $(LIB_DIR)/read.o $(LIB_DIR)/open.o $(LIB_DIR)/close.o $(LIB_DIR)/sbrk.o $(LIB_DIR)/isatty.o $(LIB_DIR)/crt0.o $(LIB_DIR)/gettimeofday.o
OBJ := $(OBJ_DIR)/main.o

$(OBJ_DIR)/$(MODULE_NAME).ko : $(OBJ) $(LIB)
	$(LD) -T linker.ld $(OBJ) $(LIB) -o $@ -lc

$(OBJ_DIR)/main.o : main.cpp
	$(CC) -o $@ main.cpp

all : $(OBJ_DIR)/$(MODULE_NAME).ko

rebuild : clean all

install :
	cp $(OBJ_DIR)/$(MODULE_NAME).ko /usr/home/NewLife/boot/ 

clean :
	- rm $(OBJ_DIR)/*.*

.PHONY : all clean rebuild install

